
/*!
  @file         SinMp4Analyzer.
  @abstract     This is the main interface for creating the mp4 movie.

  @author       Sindhu B
                Tejus Adiga M

  @copyright    copyright (c) PEL Microsystems, India.
  */


#ifndef SINMP4ANALYZER_H
#define SINMP4ANALYZER_H

/*!
  @abstract     These are the standard datatypes used. This can be platform specific.
  */
typedef unsigned long   UInt64;
typedef unsigned int    UInt32;
typedef unsigned short  UInt16;
typedef unsigned char   UInt8;
typedef long            SInt64;
typedef int             SInt32;
typedef short           SInt16;
typedef char            SInt8;

typedef UInt32 SinMp4TrackId;


/*!
  @struct       SinSampleBufferTag.
  @abstract     This structure defines input media buffer format to the movie creator.
                Users must present their media sample buffers in SinSampleBufferTag format.
  @section      buffer, the media byte buffer.
  @section      frameLength, thelength of the buffer.
  */
typedef struct SinSampleBufferTag {
    void*   buffer;
    UInt32  frameLength;
} SinSampleBuffer;


/*!
  @enum         SinMp4TrackType
  @abstract     Ennumaration defines the media types.
  */
enum SinMp4TrackType {
    SinMp4TrackTypeVideo = 'vide',
    SinMp4TrackTypeAudio = 'soun'
};


/*!
  @enum         SinMp4MediaCodec
  @abstract     Ennumaration defines the different codec types.
  */
enum SinMp4MediaCodec {
    SinMp4MediaCodecH264    = 'avc1',
    SinMp4MediaCodecMJPG    = 'mjpg',
    SinMp4MediaCodecLPCM    = 'lpcm',
    SinMp4MediaCodecAAC     = 'aac '
};


/*!
  @class        SinMp4Analyzer
  */
class SinMp4Analyzer {
public:

    static SinMp4Analyzer* CreateMp4Analyzer ();

    static void ReleaseMp4Analyzer ();

    virtual UInt32 SinMp4ExportMovie (char* movieFilename) = 0;

    virtual SinMp4TrackId SinMp4AddTrack (SinMp4TrackType   trackType,
                                          SinMp4MediaCodec  mediaCodec,
                                          UInt64            timeScale) = 0;

    virtual UInt32 SinMp4AddExtension (SinMp4TrackId    mediaTrackId,
                                       SinSampleBuffer* extension) = 0;

    virtual UInt32 SinMp4AddSample (SinMp4TrackId   mediaTrackId,
                                    SinSampleBuffer mediaBuffer) = 0;

    virtual UInt32 SinMp4FinalizeTrack (SinMp4TrackId mediaTrack) = 0;

    virtual UInt32 SinMp4FinalizeMovie () = 0;

};

#endif // SINMP4ANALYZER_H
